<style type="text/css">
	.g_list .mytd{height:25px;}
	.title_pic{float: left;}
	.title{float:right;width:70%;}
	.text-center{font-size: 14px;}
	.zhankais{cursor: pointer;float: right;color:#f88e2d;font-size: 13px;}
	.table-bordered{border: none;}#beizhu img{width:120px;}
</style>
<script type="text/javascript"> 
jQuery.fn.rowspan = function(colIdx) { //封装的一个JQuery小插件  
return this.each(function(){
var that; 
$('tr', this).each(function(row) { 
$('td:eq('+colIdx+')', this).filter(':visible').each(function(col) { 
if (that!=null && $(this).html() == $(that).html()) { 
rowspan = $(that).attr("rowSpan");
if (rowspan == undefined) { 
$(that).attr("rowSpan",1); 
rowspan = $(that).attr("rowSpan"); } 
rowspan = Number(rowspan)+1; 
$(that).attr("rowSpan",rowspan); 
$(this).hide(); 
} else { 
that = this; 
} 
}); 
}); 
}); 
}

$(function() {

	$(".g_list").rowspan(7);
	$(".g_list").rowspan(8);
	$(".g_list").rowspan(9);
	
$(".zhankais").click(function(){
	var pd=$(this).text();
	var myrel=$(this).attr('rel');
	if(pd=='收回明细'){
		$(this).text('展开明细');
		$(this).removeClass('glyphicon-chevron-up');
		$(this).addClass('glyphicon-chevron-down');
		
	}else{
		$(this).removeClass('glyphicon-chevron-down');
		$(this).addClass('glyphicon-chevron-up');
		$(this).text('收回明细');
	}
	$(".zhankai"+myrel).slideToggle();
	}); 
	
$(".table-responsive #look_biaoqian").click(function(){
	var order_id=$(this).attr('rel');
	$.getJSON('/index.php/Admin/Order/look_biaoqian/order_id/'+order_id+'?v='+new Date, function(json){
	  layer.photos({
		shade: 0.3
		,photos: json //格式见API文档手册页
		,anim: 5 //0-6的选择，指定弹出图片动画类型，默认随机
	  });
	});
	});	
	
	
}); 

</script>
             <form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
                <div class="table-responsive">
                    <table class="table table-bordered" style="font-size:13px;">
                                <tbody>
                                <volist name="orderList" id="list">
                                    <tr style="border-bottom: 2px #fff solid;">
                                        <td class="text-center" style="background:#e2e8ff;">
                                        	<input type="checkbox" name="order_id[]" value="{$list.order_id}">
                                        </td>
										<td class="text-center" style="background:#e2e8ff;">单号：{$list.order_sn}
<!--											<if condition="$list['pay_status'] eq '0' "><span style="color:#ef811c;">（ 待支付 ）</span></if>-->
<!--											<if condition="$list['pay_status'] eq '1'"><span style="color:green;">（ 已支付 ）</span></if>-->
											<if condition="$list['driver_id'] neq 0"><span style="color:green;">（ {$list.driver_name} ）</span></if>
										</td>
                                        <td class="text-center" style="background:#e2e8ff;">状态：{$order_status[$list[order_status]]}
											<if condition="$list['pay_code'] eq 'cod'"><span style="color: #9318dc">( 货到付款 )</span></if>
											<if condition="$list['pay_code'] eq 'weixin'"><span style="color: green">( 在线付款 )</span></if>
										</td>
                                        
                                        <td class="text-center" style="background:#e2e8ff;">发货：{$shipping_status[$list[shipping_status]]}</td>
                                        <td class="text-center" style="background:#e2e8ff;">下单时间：{$list.add_time|date='Y-m-d H:i',###}</td>
                                        <!--<td class="text-center" style="background:#e2e8ff;">店铺：<a href="/index.php/Seller/Admin/login/store_id/{$list.store_id}" target="_blank" title="进入商家后台">{$store_list[$list[store_id]]}</a>  <span style="color:#f88e2d;">({$list[suoshu_name]})</span></td>-->
                                        <td class="text-center" style="background:#e2e8ff;">店铺：{$store_list[$list[store_id]]}  <span style="color:#f88e2d;">({$list[suoshu_name]})</span></td>
										<td class="text-left" style="background:#e2e8ff;">
											所属区域：
										<?php
										if(session('fenbu_id')==0 && $list['order_status']<2){
										?>
										<select onchange="updateSort('order','order_id',{$list.order_id},'ufenbu_id',this)" class="input-sm">
											<?php
												foreach($fenbu_list as $v){
													if($list['ufenbu_id']==$v['fenbu_id']){
														echo '<option value="'.$v['fenbu_id'].'" selected="selected">'.$v['fenbu_name'].'</option>';
													}else{
														echo '<option value="'.$v['fenbu_id'].'">'.$v['fenbu_name'].'</option>';
													}
												}
											?>
										</select>
										<?php
										}else{
											foreach($fenbu_list as $v){
												if($list['ufenbu_id']==$v['fenbu_id']){
													echo $v['fenbu_name'];
												}
											}
										}
										?>
										</td>
                                        <td class="text-right" style="background:#e2e8ff;">
                                        	<if condition='$list.dai_type eq 1'>
											<span style="color:#ef811c;">(代客下单)</span>
											</if>
											{$list.tag}
											<if condition="$list['fast_text']">
												<span class="btn btn-danger" >{$list.fast_text}</span>
											</if>
										
                                                 <a href="{:U('Admin/order/detail',array('order_id'=>$list['order_id']))}" data-toggle="tooltip" title="" class="btn btn-info" data-original-title="查看详情"><i class="fa fa-eye"> 查看</i></a>
												 <a href="/index.php/admin/Order/order_prints/order_id/{$list.order_id}" target="_blank" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="打印订单"><i class="fa fa-print"></i>打印订单</a>
                                                 
<!--                                                 <if condition="($list['order_status'] eq 3) or ($list['order_status'] eq 5)">-->
<!--                                                        <a href="{:U('Admin/order/delete_order',array('order_id'=>$list['order_id'],'store_id'=>$list['store_id']))}"  data-toggle="tooltip" title="" class="btn btn-danger" data-original-title="删除"><i class="fa fa-trash-o"></i></a>-->
<!--                                        	<else/>-->
<!--                                        		<a href="javascript:void(0)" onclick="alert('该订单不得删除')" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="删除"><i class="fa fa-trash-o"></i></a>-->
<!--                                        	</if>-->
                                                
                                        </td>
                                    </tr>
<tr class="zhankai{$list.order_id}">
	<td class="text-center" colspan="12" style="padding:0;border: none;">
<table class="table table-bordered g_list" style="font-size:13px;width:100%;background:#f6fdff;">
<tr>
		<td width="200" class="mytd">产品名</td>
		<td width="110" class="mytd">单价</td> 
		<td width="90" class="mytd">数量</td>
		<td width="90" class="mytd">小计</td>
<?php
	if(session('role_id')!=1){}else{
?>
		<!-- <td width="80" class="mytd">平台扣点</td> -->
		<td width="80" class="mytd">平台收益</td>
<?php
}
?>
		<td width="80" class="mytd" style="color: green;">退货数</td>
		<td width="120" class="mytd">收件人</td>
		<td width="120" class="mytd">联系方式</td>
		<td width="130" class="mytd">总金额</td>
</tr>
<?php
$points_count=0;
?>
<volist name="list.g_list" id="lists">
	<?php
	$huodong=$lists['prom_msg'] ? ' <span style="color:red">'.$lists['prom_msg'].'</span>' : '';
	?>
	<tr>
		<td style="text-align:left;">
			<img src="{$lists.original_img}" height="50" width="50" class="title_pic" onmouseover="layer.tips('<img src={$lists.original_img} width=180>',this,{tips: [1, '#EAF8FF']});" onmouseout="layer.closeAll();">
			<div class="title">{$lists.goods_name} {$huodong}</div>
			<div class="title" style="color:#8e8a8a;">{$lists.spec_key_name}</div>
			<div class="title" style="color:#8e8a8a;">商品id:{$lists.goods_id}</div>
			</td>
		<td class="mytd">￥{$lists.member_goods_price}</td> 
		<td class="mytd">{$lists.goods_num}</td>
		<td class="mytd">￥{$lists['member_goods_price']*$lists['goods_num']}</td>
<?php
	if(session('role_id')!=1 ){}else{
?>
		<!-- <td class="mytd">{$lists.points}%</td> -->
		<td class="mytd" style="color: blue;">{:sanwei(($lists['points']*($lists['member_goods_price']-$lists['yijia'])*$lists['goods_num'])/100)}</td>
<?php
	}
?> 
		<td class="mytd" style="color: green;">{$lists.tuihuo_num}</td>
		<td class="mytd">{$list.consignee}（{$list.company}）  <span style="color:#f88e2d;">（{$list.biaoshi_xian}）</span></td>
		<td class="mytd">{$list.company_address}，{$list.mobile}</td>
		<td class="mytd" style="font-weight: bold;color: red;">{$list.order_amount} / <del style="color:#795548;font-weight:normal;">{$list.order_price.total_amount}</del></td>
	</tr>
</volist>
<?php
	if(session('role_id')==10 || session('role_id')==15 || session('role_id')==8){}else{
?>
<tr>
	<td class="text-right" <if condition="$_SESSION[role_id] eq 1"> colspan="4" <else/>  colspan="3" </if>>
	<div style="text-align: center;width:80%;float: left; font-weight: normal;color:#888c2c;">优惠券：{$list.coupon_name}{$list.coupon_price}，积分：{$list.integral_money}</div>
	<if condition="$_SESSION[role_id] eq 1">
		平台总扣费：
	</if>
	</td>
	<td class="text-center" style="color: blue;font-weight: bold;">
		<if condition="$_SESSION[role_id] eq 1">
		{$list.order_price.points_count}
		</if>
	</td>
	<td class="text-left" style="font-weight: bold;color: green;">退货金额：{$list.tuihuo0}</td>
	<td class="text-left" style="font-weight: bold;color: green;"></td>
	<td class="text-right" style="font-weight: bold;">应收：</td>
	<td class="text-center" style="color: red;font-weight: bold;">{$list.order_price.yinshou_price}</td>
	</tr>
<?php
	}
?>
<tr id="beizhu">
	<?php
		if(session('role_id')!=1 ){
			echo '<td class="text-center" colspan="4" id="beizhu">';
		}else{
			echo '<td class="text-center" colspan="5" id="beizhu">';
		}
	?>
		<b>平台改单：</b>
					<if condition="$list.admin_note eq ''">
							<span style="color:#999;">未改单</span>
					<else/>
							<span style="color:red;">改价：<b>￥{$list.discount}</b>，{$list.admin_note|htmlspecialchars_decode}</span>
					</if>&nbsp;&nbsp;备注：{$list.user_note|htmlspecialchars_decode}{$list.unusual_remake}
	</td>
	<td class="text-center" colspan="1" ><a href="#" onclick="tuihuo('{$list.order_sn}')" data-toggle="tooltip" title="" class="btn btn-info" data-original-title="退货">退货</a></td>
	<td class="text-center" colspan="1" style="color:green;">入库：（<span id="ruku_num">{$list.ruku}</span>件）<a href="#" onclick="rukuAll('{$list.order_id}','{$list.jian_count}')" data-toggle="tooltip" title="" class="btn btn-info" data-original-title="一键入库">一键入库</a></td>
    <td class="text-center" colspan="1" style="color:red;">发货：（<span id="chuku_num">{$list.chuku}</span>件）<a href="#" onclick="chukuAll('{$list.order_id}','{$list.jian_count}')" data-toggle="tooltip" title="" class="btn btn-info" data-original-title="一键出库">一键出库</a></td>
	<td class="text-center" colspan="1" id="look_biaoqian" rel="{$list.order_id}" style="cursor: pointer;" title="点击查看标签">
		标签数<span style="color:#f88e2d;">（查看）</span>：<b style="color: red;">{$list.jian_count}</b>
	</td>
</tr>
</table>
	</td>
</tr>
                                </volist>
                                </tbody>
                            </table>
                        </div>
                    </form>
                    <div class="row">
                        <div class="col-sm-6 text-left"></div>
                        <div class="col-sm-6 text-right">{$page}</div>
                    </div>
<script>
    $(".pagination  a").click(function(){
        var page = $(this).data('p');
        ajax_get_table('search-form2',page);
    });

	function rukuAll(order_id,ruku_num){
		$.ajax({
			type:'post',
			url:"{:U('Admin/order/ruku_all')}",
			data:{order_id:order_id},
			success:function(res){
				if(res){
					let data = JSON.parse(res);
					if(data.status){
						layer.msg(data.msg, {icon:6},function(){
							$("#ruku_num").html(ruku_num)
						});
					}else{
						layer.msg(data.msg, {icon:5},function(){});
					}

				}
			}
		});
	}

	function chukuAll(order_id,chuku_num){
		layer.prompt({
			formType: 2,
			title: '请输入司机全名',
		}, function(value, index, elem){
			$.ajax({
				type:'post',
				url:"{:U('Admin/order/chuku_all')}",
				data:{order_id:order_id,driver_name:value},
				success:function(res){
					if(res){
						layer.close(index);
						let data = JSON.parse(res);
						if(data.status){
							layer.msg(data.msg, {icon:6},function(){
								$("#chuku_num").html(chuku_num)
							});
						}else{
							layer.msg(data.msg, {icon:5},function(){
								// window.location.reload(true)
							});
						}

					}
				}
			});
		});

	}

	function tuihuo(order_sn)
	{
		var myrul='/index.php?m=admin&c=Order&a=tuihuo_edit_order&order_sn='+order_sn;//+myrel;
		layer.open({
			type: 2,
			shadeClose: true, //点击遮罩关闭
			title:'添加退货',
			skin: 'layui-layer-rim', //加上边框
			area: ['80%', '80%'], //宽高
			content: myrul
		});
	}
</script>